
//
//  SZHomePageCell.swift
//  WeiBoExercise
//
//  Created by lx on 16/9/27.
//  Copyright © 2016年 BeiWo. All rights reserved.
//

import UIKit

import SDWebImage



class SZHomePageCell: UITableViewCell {

    
    @IBOutlet weak var iconButton: UIButton!
    
    @IBOutlet weak var iconImage: UIImageView!
    
    @IBOutlet weak var screenName: UILabel!
    
    @IBOutlet weak var sourceLabel: UILabel!
    
    @IBOutlet weak var contentLabel: UILabel!
    
    
    
    @IBOutlet weak var repostButton: UIButton!
    
    @IBOutlet weak var repostCount: UILabel!
    
    @IBOutlet weak var commentButton: UIButton!
    
    @IBOutlet weak var commentCount: UILabel!
    
    
    @IBOutlet weak var attitudeButton: UIButton!
    
    @IBOutlet weak var attitudeCount: UILabel!
    
    @IBOutlet weak var attitudeImage: UIImageView!
    
    
    
    var model : SZHomePageModel?
    {
        
        didSet
        {
        
            let url = NSURL.init(string: (model?.user!.profile_image_url)!)
            iconImage.sd_setImageWithURL(url)
            
            screenName.text = model?.user?.screen_name
            
            sourceLabel.text = model?.source
            
            contentLabel.text = model?.text
//            print("\(model!.reposts_count!)")
            repostCount.text = "\(model!.reposts_count!)"
            
            commentCount.text = "\(model!.comments_count!)"
            
            attitudeCount.text = "\(model!.attitudes_count!)"
            
        }
        
    }
    
    
    
    override func awakeFromNib() {
        super.awakeFromNib()

    
        iconButton.layer.cornerRadius = iconButton.bounds.size.height/2.0
        iconButton.layer.masksToBounds = true
        
        
        iconImage.layer.cornerRadius = iconImage.bounds.size.height/2.0
        iconImage.layer.masksToBounds = true
        

    
    }

    override func setSelected(selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
